package org.yefei.homeworkday06;

import java.util.Scanner;

public class HomeWorkEight {

	public static void main(String[] args) {
		// 8：如果斐波拉切数列的前N项，N由用户输入。
		// 斐波拉切数列的定义是前两个是1，后面的每一个是前面的两个和
		// ，比如N是5,则输出结果是1,1,2,3,5
		System.out.println("请输入位数：");
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int first = 1, second = 1, next;
		System.out.print("1 " + "1 ");
		for (int i = 3; i <= N; i++) {
			next = first + second;
			first = second;
			second = next;
			System.out.print(next + " ");
		}
	}

}
